<!DOCTYPE html>
<html class="x-admin-sm" xmlns:th="http://www.thymeleaf.org"
      xmlns:sec="http://www.thymeleaf.org/extras/spring-security"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <meta charset="UTF-8">
    <title>自习室详情</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,room-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi"/>
    <link rel="stylesheet" th:href="@{/css/font.css}">
    <link rel="stylesheet" th:href="@{/css/xadmin.css}">
    <link rel="stylesheet" th:href="@{/css/roominfo.css}">
    <script th:src="@{/lib/layui/layui.js}" charset="utf-8"></script>
    <script type="text/javascript" th:src="@{/js/xadmin.js}"></script>
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>

<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <form class="layui-form" th:action="@{/room/getRoomInfo}" style="padding: 17px 0">
                    <input type="hidden" id="L_id" name="id" required="" lay-verify="id"
                           autocomplete="off" class="layui-input" readonly th:value="${info.id}">
                    <div class="layui-form-item">
                        <label class="layui-form-label">日期</label>
                        <div class="layui-inline">
                            <input id="date" type="text" name="date" required placeholder="请输入时间" class="layui-input" th:value="${dateinfo}"/>
                        </div>
                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                            </div>
                        </div>
                    </div>
                </form>

                <div class="main">
                    <h5 style="font-size: 18px;">
                        自习室名称: <span style="color: green" th:text="${info.name}"></span>
                        时间: <span style="color: black" th:text="${dateinfo}"></span>
                    </h5>
                    <div class="seat-all">
                        <span th:each="seat,stat:${info.list}" class="seat-item" th:title="'座位号' + ${seat.seatNo}" th:onclick="xadmin.open('座位',[['/room/toSeatInfo?id='+${seat.id}+'&date='+${dateinfo}]])">
                            <div class="seat-no-tip" th:text="${seat.seatNo}"></div>
                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
<script>
    layui.use(['laydate', 'form', 'layer'],
        function () {
            var laydate = layui.laydate;

            //日期选择器
            laydate.render({
                elem: '#date',
                min:new Date().toLocaleString()
            });
        });
</script>
<script>
    /*用户-删除*/
    function member_del(obj, id) {
        layer.confirm('确认要删除吗？', function (index) {
            console.log(id)
            $(obj).parents("tr").remove();
            layer.msg('已删除!', {icon: 1, time: 1000});
            //发异步删除数据
            $.ajax({
                url: "/admin/deleteRoom",
                type: "POST",
                data: {"id": id},
                dataType: 'json',
                success: function (result) {
                },
            });

        });
    }


    function delAll(argument) {
        var ids = [];

        // 获取选中的id
        $('tbody input').each(function (index, el) {
            if ($(this).prop('checked')) {
                ids.push($(this).val())
            }
        });

        layer.confirm('确认要删除吗？' + ids.toString(), function (index) {
            //捉到所有被选中的，发异步进行删除
            layer.msg('删除成功', {icon: 1});
            $(".layui-form-checked").not('.header').parents('tr').remove();
        });
    }
</script>
</html>
